package com.ssm.blog.controller;

import com.github.pagehelper.PageInfo;
import com.ssm.blog.pojo.Diary;
import com.ssm.blog.service.DiaryService;
import com.ssm.blog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/diary")
public class DiaryController {

    @Autowired
    private DiaryService diaryService;

    @Autowired
    private UserService userService;

    @RequestMapping("/list.html")
    @ResponseBody
    public PageInfo<Diary> list(Integer pageNum) {
        return diaryService.getDiaryList(pageNum,7);
    }
    @RequestMapping("/page.html")
    public String list() {
        return "diary_list";
    }
}
